function avg = avg(v)
  [K, M] = size(v);
  avg = zeros(K, 1);
  for i=1:K
    avg(i) = sum(v(i,:)) / M;
  endfor
endfunction
